import request from '@/utils/request'

// 新增优惠券
export function addCoupon(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/add',
    method: 'post',
    data: query
  })
}
// 根据编号查询优惠券
export function getCouponId(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/getById',
    method: 'get',
    params: query
  })
}

// 优惠券修改
export function updateCoupon(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/updateById',
    method: 'post',
    data: query
  })
}

// 优惠券下架
export function updateIsRelease(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/updateIsRelease',
    method: 'post',
    data: query
  })
}

// 查询课程集合
export function listByBusiness(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/getCourses',
    method: 'get',
    params: query
  })
}

// 优惠券分页查询
export function couponList(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/coupon/pageList',
    method: 'get',
    params: query
  })
}

// 统计机构优惠券
export function couponReceive(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/couponReceive/statis',
    method: 'get',
    params: query
  })
}

// 统计机构券数量
export function couponReceiveStatis(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/couponReceive/couponReceiveStatis',
    method: 'get',
    params: query
  })
}

// 优惠券名单
export function couponReceiveList(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/couponReceive/receiveList',
    method: 'get',
    params: query
  })
}

// 优惠券导出
export function couponExport(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/couponReceive/export',
    method: 'get',
    params: query
  })
}

// 一键核销
export function updateBatchByIds(query) {
  return request({
    url: '/jbl-marketing/api/merchant/v1/couponReceive/updateBatchByIds',
    method: 'post',
    data: query
  })
}
